import 'package:environmental_les_app/common/routes/route_names.dart';
import 'package:environmental_les_app/common/style/colours.dart';
import 'package:environmental_les_app/common/style/font_style.dart';
import 'package:environmental_les_app/common/widgets/common_widget.dart';
import 'package:environmental_les_app/common/widgets/rich_text.dart';
import 'package:flutter_clx_base/flutter_clx_base.dart';

class ClueItem extends StatelessWidget {
  final Map<String, dynamic> item;
  // 是否创建任务
  final bool isCreateTask;

  const ClueItem({super.key, required this.item, this.isCreateTask = false});

  @override
  Widget build(BuildContext context) {
    return baseCardContainer(
        onTap: () {
          Get.toNamed(isCreateTask
              ? AppRoutes.warningDetailPage
              : AppRoutes.warningListPage);
        },
        content: [
          Row(
            children: [
              borderContainer(test: "空气站点", textColor: Colours.appMain),
              hGap8,
              Text(
                "(环保局)",
                style: FontStyles.title,
              ),
              hGap8,
              Text(
                "薛家湾",
                style: FontStyles.title,
              )
            ],
          ),
          vGap10,
          backgroundContainer(
              padding: const EdgeInsets.symmetric(
                  horizontal: 10.0, vertical: 8.0), // 内边距
              child: Row(
                children: [
                  // 红色圆环
                  circularRing(color: Colours.lineFF5B05),
                  hGap5,
                  Container(
                    constraints: const BoxConstraints(maxWidth: 280),
                    child: Text(
                      "这是具体的描述信息这是具体的描述信息这是具体的描述信息",
                      style: FontStyles.textCustom09c(15),
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                ],
              )),
          Visibility(
              visible: !isCreateTask,
              child: itemRowTwoStr(
                  icon: Icons.warning_amber_outlined,
                  title: "报警/处理次数:",
                  rightWidget: const RichTextWidget(children: [
                    TextSpan(
                        text: '5/',
                        style: TextStyle(
                            fontSize: 15,
                            color: Colours.text969,
                            fontWeight: FontWeight.normal)),
                    TextSpan(
                        text: "2",
                        style: TextStyle(
                            fontSize: 15,
                            color: Colours.appMain,
                            fontWeight: FontWeight.w500)),
                  ]))),
          itemRowTwoStr(
              paddingBottom: 0.0,
              icon: Icons.access_time,
              title: "最新报警时间:",
              rightWidget: Text(
                "2023-03-15 10:00",
                style: FontStyles.textCustom969(15),
              )),
        ]);
  }
}
